package com.aisile.manager.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class LoginController {

    @RequestMapping("/getUsername")
    public Map getUsername(){
        Map map=new HashMap();
        map.put("name",SecurityContextHolder.getContext().getAuthentication().getName());
        return map;
    }
}
